package com.xinqi.modules.third.controller;

import com.xinqi.common.base.response.R;
import com.xinqi.common.core.web.controller.BaseController;
import com.xinqi.modules.third.service.CheckAreaService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.validation.constraints.NotBlank;

/**
 * 邮件功能
 *
 * @author dgyu
 */
@Slf4j
@Validated
@RestController
@RequestMapping("/area")
@RequiredArgsConstructor
public class CheckAirController extends BaseController {

    private final CheckAreaService checkAreaService;

    /**
     * 地区校验
     *
     * @param mobile
     * @return
     */
    @GetMapping("/check")
    public R<String> checkArea(@NotBlank(message = "手机号不能为空") String mobile, HttpServletRequest request) {
        return checkAreaService.checkArea(mobile, request);
    }

}
